class Solution {
public:
    int firstUniqChar(string s) {
        //统计只出现一次的字符
       //int* count = new int[256]();
        int count[256] = { 0 };
        size_t size = s.size();
        // for(size_t i = 0; i < size; i++)
        //     count[s[i]] += 1;
        for (auto e : s)
            count[e]++;

        for (size_t i = 0; i < size; i++)
            if (1 == count[s[i]])
                return i;
        //delete[] count;      
        return -1;

    }
};